<?php
    defined('_VALID_MOS') or die(include_once("../../404.php"));

    $sql = "SELECT `news`.`News_Id`, `news`.`Title`, `news`.`alias`, `news`.`Description`, `news`.`img_file`,`news`.`img_status`,
		Date_Format(`news`.`Date`, '%d/%m/%Y - %h:%m') AS `date_add`, DateDiff(CurDate(), `news`.`Date`) AS `Expires`
		FROM `news` INNER JOIN `category` ON `category`.`Cat_Id` = `news`.`CatID` INNER JOIN `session` ON `session`.`Ses_Id` = `category`.`SesID`
		WHERE `news`.`Status` = 1
		ORDER BY `news`.`Date` DESC LIMIT 0, ? ";
// sá»‘ dÃ²ng láº¥y ra
    $limit = 5;
    $cmd = $mysqli->prepare($sql);
    $cmd->bind_param("s", $limit);
    $cmd->execute() or die($mysqli->error);
    $cmd->bind_result($News_Id, $Title, $alias, $Description, $img_file, $img_status, $date_add, $Expires);
    $cmd->store_result();
?>

<div id="component">
    <p class="d_title">Tin mới</p>
    <div class="content">
        <?php
            while($cmd->fetch())
            {
                ?>
                <!-- article -->
                <div class="d_article">	
                    <?php
                    if($img_status != 0)
                    {
                        echo "<div class=\"image\"><a href=./com_content/article/$alias/" . $_GET["item"] . ".htm><img align=\"left\" src=\"$img_file\"></a></div>";
                    }
                    ?>                		
                    <a class="d_title" href="<?php echo "./com_content/article/$alias/" . $_GET["item"] . ".htm"; ?>"><?php echo $Title; ?></a>
                    <div class="d_date"><?php echo $date_add; ?></div>                					                                

                    <div class="d_description"><?php echo $Description; ?></div>                    
                </div> 
                <!-- end article -->
                <?php
            }
        ?>
    </div>
</div>